<?php

/**
 * This is the model class for table "jumlahternakbesar".
 *
 * The followings are the available columns in table 'jumlahternakbesar':
 * @property integer $jtb_id
 * @property integer $jtb_kec
 * @property integer $jtb_sapipotong_jantan
 * @property integer $jtb_sapipotong_betina
 * @property integer $jtb_sapiperah_jantan
 * @property integer $jtb_sapiperah_betina
 * @property integer $jtb_kerbau_jantan
 * @property integer $jtb_kerbau_betina
 * @property integer $jtb_kuda_jantan
 * @property integer $jtb_kuda_betina
 * @property integer $jtb_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jtbKec
 */
class Jumlahternakbesar extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahternakbesar the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahternakbesar';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jtb_kec, jtb_sapipotong_jantan, jtb_sapipotong_betina, jtb_sapiperah_jantan, jtb_sapiperah_betina, jtb_kerbau_jantan, jtb_kerbau_betina, jtb_kuda_jantan, jtb_kuda_betina, jtb_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jtb_id, jtb_kec, jtb_sapipotong_jantan, jtb_sapipotong_betina, jtb_sapiperah_jantan, jtb_sapiperah_betina, jtb_kerbau_jantan, jtb_kerbau_betina, jtb_kuda_jantan, jtb_kuda_betina, jtb_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jtbKec' => array(self::BELONGS_TO, 'Kecamatan', 'jtb_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jtb_id' => 'Jtb',
			'jtb_kec' => 'Jtb Kec',
			'jtb_sapipotong_jantan' => 'Sapi Potong Jantan',
			'jtb_sapipotong_betina' => 'Sapi Potong Betina',
			'jtb_sapiperah_jantan' => 'Sapi Perah Jantan',
			'jtb_sapiperah_betina' => 'Sapi Perah Betina',
			'jtb_kerbau_jantan' => 'Kerbau Jantan',
			'jtb_kerbau_betina' => 'Kerbau Betina',
			'jtb_kuda_jantan' => 'Kuda Jantan',
			'jtb_kuda_betina' => 'Kuda Betina',
			'jtb_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jtb_id',$this->jtb_id);
		$criteria->compare('jtb_kec',$this->jtb_kec);
		$criteria->compare('jtb_sapipotong_jantan',$this->jtb_sapipotong_jantan);
		$criteria->compare('jtb_sapipotong_betina',$this->jtb_sapipotong_betina);
		$criteria->compare('jtb_sapiperah_jantan',$this->jtb_sapiperah_jantan);
		$criteria->compare('jtb_sapiperah_betina',$this->jtb_sapiperah_betina);
		$criteria->compare('jtb_kerbau_jantan',$this->jtb_kerbau_jantan);
		$criteria->compare('jtb_kerbau_betina',$this->jtb_kerbau_betina);
		$criteria->compare('jtb_kuda_jantan',$this->jtb_kuda_jantan);
		$criteria->compare('jtb_kuda_betina',$this->jtb_kuda_betina);
		$criteria->compare('jtb_tahun',$this->jtb_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}